<?php

/**
 * Description of ResourceParameterService
 *
 * @author gun
 */
class Admin_Model_ResourceParameterService extends Admin_Model_BaseService {
    protected $daoClass = 'Admin_Model_DbTable_ResourceParameter';
    
    public function findAll($where = array(), $options = array()) {
        $data = $this->getDao()->findAll($where, $options);
        
        $mdtory = array(
            array('mandatory'=>'0', 'name'=>'Yes'), 
            array('mandatory'=>'1', 'name'=>'No')
        );
        
        foreach ($data as $key => $value) {
            foreach ($mdtory as $k => $v) {
                if ($v['mandatory'] === $value['mandatory'])
                    $data[ $key ]['mandatory'] =  $v['name'];
            }
        }
        
        return $data;
    }
    
    public function getRow($id = '') {
        $data = $this->getDao()->getRow($id);
        
        return $data;
    }
    
    public function countRows($where = '') {
        return $this->getDao()->countRows($where);
    }
    
    public function doUpdate($data = array(), $where = '') {
        return $this->getDao()->doUpdate($data, $where);
    }
    
    public function doSave($data = array()) {
        return $this->getDao()->doSave($data);
    }
    
    public function doDelete($where = '') {
        return $this->getDao()->doDelete($where);
    }
}

?>
